//
//  ProjectileFactory.m
//  iFly
//
//  Created by User-10 on 12/7/14.
//  Copyright (c) 2014 TeamDifferent. All rights reserved.
//

#import "ProjectileFactory.h"
#import "LaserProjectile.h"

@implementation ProjectileFactory

+ (ProjectileNode*) createProjectileWithType:(ProjectileType) type andPosition:(CGPoint) position inScene:(SKScene*) scene {
    
    ProjectileNode* projectile;
    
    if (type == ProjectileTypeLaser) {
        projectile = [LaserProjectile laserWithPosition:position andDamage:1];
    }
    if (type == ProjectileTypeTripleLaser) {
        CGPoint up = CGPointMake(position.x+upLaserX, position.y+upLaserY);
        CGPoint down = CGPointMake(position.x+upLaserX, position.y-upLaserY);
        [LaserProjectile shootLaserFromPosition:position atDirection:up inScene:scene];
        //without mid laser because the default that we return is the mid one
        [LaserProjectile shootLaserFromPosition:position atDirection:down inScene:scene];
        
        projectile = [LaserProjectile laserWithPosition:position andDamage:1];
    }
    [scene addChild:projectile];
    
    return projectile;
}

@end
